# Python 2.6.4
# Project Euler, Problem 48
# Copyright 2010 Talha Zaman

sum=0
for i in range(1,1001): sum += i**i
print str(sum)[-10:]
